package cc.iteachyou.template.utils;

import java.util.Map;

public class VariableHelper {
    private ThreadLocal<Map<String, Object>> local = new ThreadLocal<>();

    private static VariableHelper helper = null;

    /**
     * 构造函数
     */
    private VariableHelper(){}

    /**
     * 获取模板引擎助手实例
     * @return
     */
    public static VariableHelper getInstance(){
        if(helper == null){
            helper = new VariableHelper();
        }
        return helper;
    }

    public void set(Map<String, Object> data){
        local.set(data);
    }

    public Map<String, Object> get(){
        return local.get();
    }
}
